<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ include file="../include/header.jsp" %>
<div id="main">
    <div id="container">
        <div id="content">
            <%
                        String ec = request.getParameter("ec");
                        String error = "";
                        if (ec != null) {
                            if (ec.equals("error")) {
                                out.print("<div class='message-box error'>La photo demand&eacute;e n'existe pas.</div>");
                            }
                        } else {
            %>
            <div id="post-898" class="hentry p1 post publish author-admin category-blogs category-companies tag-blue tag-brown comments-open pings-closed y2009 m08 d16 h13 slug-envira-media">
                <div class="entry-content">
                    <h1>${requestScope['nomPhoto']}</h1>
                    <p>${requestScope['description']}</p>
                    <div style="clear:both;"></div>
                    <ul class="meta">
                        <li class="designer">Photographe : ${requestScope['loginAuteur']}</li>
                        <c:if test="${ sessionScope['id']==requestScope['idAuteur'] }">
                            <li class="delete">
                                <a href="PhotoServlet?action=delete&IdPhoto=${requestScope['idPhoto']}">Supprimer la photo</a>
                            </li>
                        </c:if>
                    </ul>
                    <div id="nav-below" class="navigation">
                        <div class="nav-previous"><a href="AlbumServlet?action=view&IdAlbum=${requestScope['idAlbum']}"><span class="meta-nav">&laquo;</span> Retour à l'album - ${requestScope['album']}</a></div>
                        <div class="nav-next"></div>
                    </div>
                </div>

            </div><!-- .post -->
            <div  style="float:left;  margin-left: -935px">
                <div class="picture-container">
                    <div class="entry-picture">
                        <a href="upload/${requestScope['idAuteur']}/${requestScope['idAlbum']}/${requestScope['pathFile']}" rel="colorbox">
                            <img src="upload/${requestScope['idAuteur']}/${requestScope['idAlbum']}/${requestScope['pathFileThumb']}" id="photo"/>
                        </a>
                    </div><!-- /.entry-artwork -->
                </div><!-- /.artwork-container -->

            </div>
            <div id="comments">
                <div id="comments-list" class="comments">
                    <h3><span>${requestScope['countCommentaires']}</span> Commentaire<c:if test="${requestScope['countCommentaires'] > 1}">s</c:if></h3>
                    <ol>
                        <c:forEach var="commentaire" items="${requestScope['commentaires']}">
                            <li id="comment-457" class="comment c1 c-y2009 c-m08 c-d17 c-h15 depth-1">
                                <div class="comment-author">
                                    <img alt='' src='upload/${commentaire.photo.album.auteur.id}/${commentaire.photo.album.id}/${commentaire.photo.pathThumbHome}' class='photo avatar avatar-80 photo' height='80' width='80' />
                                    <span class="fn n">
                                            ${commentaire.auteur.login}
                                    </span>
                                </div>
                                <div class="comment-meta">
                                    ${commentaire.creationToString}
                                </div>
                                <div class="comment-content">
                                    <p>
                                        ${commentaire.texte}
                                    </p>
                                </div>
                            </li>
                        </c:forEach>
                    </ol>
                    <div id="comments-nav-below" class="comment-navigation">
                        <div class="paginated-comments-links"></div>
                    </div>
                </div><!-- #comments-list .comments -->
                <div id="respond">
                    <h3>Laisser un commentaire</h3>

                    <div id="cancel-comment-reply"><a rel="nofollow" id="cancel-comment-reply-link" href="#respond" style="display:none;">Click here to cancel reply.</a></div>
                    <div class="formcontainer">
                        <form id="commentform" action="#" method="post">

                            <div id="form-section-comment" class="form-section">
                                <div class="form-label"><label for="comment">Comment</label></div>
                                <div class="form-textarea"><textarea id="comment" name="comment" cols="45" rows="8" tabindex="6"></textarea></div>
                            </div><!-- #form-section-comment .form-section -->

                            <div class="form-submit">
                                <input type="hidden" id="idPhoto" name="idPhoto" value="${requestScope['idPhoto']}" />
                                <input id="submit" name="submit" type="submit" value="Commenter" tabindex="7" />
                            </div>
                        </form><!-- #commentform -->
                    </div><!-- .formcontainer -->
                </div><!-- #respond -->
            </div><!-- #comments -->
            <%  }

            %>
        </div><!-- #content -->

    </div><!-- #container -->
</div><!-- #main -->
<script type="text/javascript">
    $(function(){
        $("#photo").click(function(){
            $("a[rel='colorbox']").colorbox({maxHeight:"90%",maxWidth:"90%"});
        });
    });
</script>
<%@ include file="../include/footer.jsp" %>